@mixin round-top {
  border-top-right-radius: $border-radius;
  border-top-left-radius: $border-radius;
}

@mixin round-bottom {
  border-bottom-right-radius: $border-radius;
  border-bottom-left-radius: $border-radius;
}

////////////////////////////////////////////////////////

.modal {
  position: fixed;
  width: 100vw;
  height: 100vh;
  transition: top .3s;
  z-index: 3;
  display: flex;
  border: 5px;
  top: -110%;

  @each $color, $value in $theme-colors {
    &-#{$color} {
      border-color: $value;
    }

    &-#{$color} &-header {
      background-color: $value;
      color: var(--white);
    }

    &-#{$color} &-container {
      border-color: $value;
    }
  }

  &-cover {
    position: absolute;
    top: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2;
    backdrop-filter: blur(5px);
  }

  &-container {
    background-color: aliceblue;
    @include round-top;
    @include round-bottom;
    // top: $modal-margin-top;
    position: relative;
    width: $modal-width;
    min-height: 40vh;
    margin: auto;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    transition: top .5s;
    z-index: 3;
    box-sizing: border-box;
    box-shadow: 1px 1px 4px 1px var(--secondary);

    &-close {
      position: absolute;
      top: $modal-padding;
      right: $modal-padding;
      color: #fff;

      & > .btn {
        font-size: 125%;
      }
    }
  }

  &-header {
    flex: 0 1 auto;
    margin: auto;
    text-align: center;
    width: 100%;
    padding: $modal-padding 0;
    border-color: $dark;
    font-weight: bold;
    min-height: 1em;
    @include round-top;
  }

  &-content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
  }

  &-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 3rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;

    & .ignore {

    }

    & .negative {
      margin-left: auto;
      margin-right: 1rem;
    }

    & .positive {

    }
  }

  &-lg &-container {
    width: $modal-width-lg;
  }

  &-sm &-container {
    width: $modal-width-sm;
  }

  &.dark-cover .modal-cover {
    background-color: rgba(0, 0, 0, 0.6);
  }

  &.show {
    top: 0;
    display: flex;

    & .modal-cover {
      animation: modal-cover-in 1s cubic-bezier(0, 0.2, 0.8, 1);
    }
  }
}

@keyframes modal-cover-in {
  0% {
    display: none;
    opacity: 0;
  }

  20% {
    display: block;
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

@keyframes modal-cover-out {
  0% {
    opacity: 1;
    display: block;
  }

  80% {
    opacity: 0;
  }

  100% {
    display: none;
  }
}
